home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / src / blockaddr / ch_blockaddr.c next >
Encoding:
C/C++ Source or Header  |  1988-03-28  |  3.4 KB  |  136 lines

  1. #include "util.h"
  2. #include "mmdf.h"
  3. #include "ap.h"
  4. /*
  5.  *     MULTI-CHANNEL MEMO DISTRIBUTION FACILITY  (MMDF)
  6.  *     
  7.  *
  8.  *     Copyright (C) 1979,1980,1981  University of Delaware
  9.  *     
  10.  *     Department of Electrical Engineering
  11.  *     University of Delaware
  12.  *     Newark, Delaware  19711
  13.  *
  14.  *     Phone:  (302) 738-1163
  15.  *     
  16.  *     
  17.  *     This program module was developed as part of the University
  18.  *     of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
  19.  *     
  20.  *     Acquisition, use, and distribution of this module and its listings
  21.  *     are subject restricted to the terms of a license agreement.
  22.  *     Documents describing systems using this module must cite its source.
  23.  *
  24.  *     The above statements must be retained with all copies of this
  25.  *     program and may not be removed without the consent of the
  26.  *     University of Delaware.
  27.  *     
  28.  *
  29.  *     version  -1    David H. Crocker    March   1979
  30.  *     version   0    David H. Crocker    April   1980
  31.  *     version  v7    David H. Crocker    May     1981
  32.  *     version   1    David H. Crocker    October 1981
  33.  *
  34.  */
  35.  
  36. /*                  ADDRESS BLOCKING CHANNEL                             */
  37.  
  38. #include <signal.h>
  39. #include "phs.h"
  40. #include "ch.h"
  41.  
  42. extern LLog *logptr;
  43.  
  44. Chan *chanptr;
  45. char obuf[BUFSIZ];        /* Buffer for status printfs */
  46.  
  47. /*      MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN     */
  48.  
  49. main (argc, argv)
  50. int       argc;
  51. char   *argv[];
  52. {
  53.     char *dupfpath ();
  54.     short retval;
  55.  
  56.     mmdf_init (argv[0]);
  57.     setbuf( stdout, obuf );
  58.  
  59. #ifdef RUNALON
  60.     logptr -> ll_fd = 1;
  61.     ll_init (logptr);
  62. #endif
  63.  
  64.     siginit ();
  65.     signal (SIGINT, SIG_IGN);     /* always ignore interrupts             */
  66.  
  67.     if ((chanptr = ch_nm2struct (argv[0])) == (Chan *) NOTOK)
  68.     {
  69.     ll_log (logptr, LLOGTMP, "blockaddr (%s) unknown channel", argv[0]);
  70.     exit (RP_PARM);
  71.     }
  72.     retval = ch_blockaddr (argc, argv);
  73.     ll_close (logptr);
  74.     exit (retval);
  75. }
  76. /* **************  (ch_) ADDRESS BLOCKING DELIVERY  ******************** */
  77.  
  78. ch_blockaddr (argc, argv)              /* send to internet                   */
  79. int       argc;
  80. char   *argv[];
  81. {
  82.     ch_llinit (chanptr);
  83. #ifdef DEBUG
  84.     ll_log (logptr, LLOGBTR, "ch_blockaddr()");
  85. #endif
  86.  
  87.     if ((chanptr->ch_apout & AP_822) != AP_822) {
  88.     ll_log (logptr, LLOGTMP, "blockaddr channel must have ap=822");
  89.     ll_log (logptr, LLOGTMP, "Fix and then edit queued messages");
  90.     return(RP_NO);
  91.     }
  92.  
  93.     if (rp_isbad (qu_init (argc, argv)))
  94.     return (RP_NO);          /* problem setting-up for deliver     */
  95.     
  96.     phs_note (chanptr, PHS_WRSTRT);
  97.  
  98.     if (rp_isbad (qu2ba_send ()))
  99.     return (RP_NO);          /* send the batch of outgoing mail    */
  100.  
  101.     phs_note (chanptr, PHS_WREND);
  102.  
  103.     qu_end (OK);                  /* done with Deliver function         */
  104.  
  105.     return (RP_OK);          /* NORMAL RETURN                      */
  106. }
  107.  
  108. /* */
  109.  
  110. /* VARARGS2 */
  111. err_abrt (code, fmt, b, c, d)     /* terminate ourself                  */
  112. short     code;
  113. char    fmt[],
  114.         b[],
  115.         c[],
  116.         d[];
  117. {
  118. #ifdef DEBUG
  119.     char linebuf[LINESIZE];
  120. #endif
  121.  
  122.     qu_end (NOTOK);
  123.  
  124. #ifdef DEBUG
  125.     if (rp_gbval (code) == RP_BNO || logptr -> ll_level >= LLOGBTR)
  126.     {                         /* don't worry about minor stuff      */
  127.     sprintf (linebuf, "%s%s", "err [ ABEND (%s) ]\t", fmt);
  128.     ll_log (logptr, LLOGFAT, linebuf, rp_valstr (code), b, c, d);
  129.     abort ();
  130.     }
  131. #endif
  132.     ll_close (logptr);            /* in case of cycling, close neatly   */
  133.  
  134.     exit (code);
  135. }
  136.